Repository navigation
feat(generate): sculpt mode with Grab, Smooth, Inflate and Flatten brushes - #436
Merged
Merged
Conversation
…nto a GLB POST /optimize/patch-vertices appends new float32 POSITION/NORMAL accessors for the edited primitives to a copy of the GLB and repoints the primitive attributes, leaving existing accessors, textures, materials and extensions untouched.
Grab, smooth, inflate and flatten brushes on raw typed arrays, acting on welded vertices so UV-seam duplicates never tear. Integer-keyed hash weld, CSR adjacency, a dense re-bucketing grid for sphere queries, regional normal updates, symmetry with blended mirrored dabs, and first-touch stroke records that restore() swaps for undo/redo.
Sculpt section in the Edit panel (Grab, Smooth, Inflate, Flatten, radius, strength, X/Y/Z symmetry), stroke input and brush ring in the viewer, local stroke undo/redo, and a commit to POST /optimize/patch-vertices that lands as one global mesh edit. Pending strokes are saved before export, Edit ops, chat messages, global undo/redo, import and library open.
# Conflicts: # package.json
trimesh decodes glTF images with Pillow but does not depend on it. The setup venv therefore had no Pillow, and every op that reloads and re-exports a mesh (presets, transforms, normals) silently wrote it back without its textures. The dev .venv happened to have it, which hid the bug. Changing requirements.txt also changes its hash, so existing installs re-run setup and get Pillow on the next launch.
…essor The viewer loads a shared accessor once, so a stroke moves every primitive using it. Patching only the clicked primitive made the others snap back after the reload and tore the mesh.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Blender-like sculpt mode in the Generate viewer, driven from a new Sculpt section of the Edit panel.
G/S/I/Tpick a brush,F/Shift+Fchange the radius,Ctrlinverts, holdingShiftsmooths,Ctrl+Z/Ctrl+Yundo per stroke,Escor Done saves and leaves.POST /optimize/patch-vertices, which goes on the mesh undo stack as a singleapplyMeshEditstep.This branch also contains the Pillow fix from #435. That part of the diff disappears once #435 is merged.
Closes #432
Closes #433
Review fix
Primitives that share one POSITION accessor (multi-material meshes) share one buffer in the viewer, so a stroke moves all of them. The patch now repoints every primitive that uses the accessor, not only the one that was clicked. Before, the others snapped back after the reload and the mesh tore.
Test plan
npm run test:node: 212 pass, which includes the SculptMesh core, perf and sculptLogic suitespython -m unittest tests.test_optimize_patch_vertices tests.test_requirements: 14 OKsrc/areas/generate. tsc shows no errors in the new files; the remaining errors are already on dev (assetLibrary, workflowRunStore).